<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>分类</title>
<#include "/public_include/easyui-allresource.html">
<link rel="stylesheet" type="text/css" href="/static/plugins/jquery-easyui-1.4.3/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="/static/plugins/jquery-easyui-1.4.3/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/static/css/admin/main.css">
<link rel="stylesheet" type="text/css" href="/static/css/admin/style.css">
<style type="text/css">
	.datagrid-cell-c2-id {
		width: 72px
	}
	.datagrid-cell-c2-text {
		width: 192px
	}
	.datagrid-cell-c2-type_name {
		width: 92px
	}
	.datagrid-cell-c2-cat_order {
		width: 72px
	}
	.datagrid-cell-c2-progress {
		width: 100px
	}
	.datagrid-cell-c2-add {
		width: 37px
	}
	.datagrid-cell-c2-edit {
		width: 37px
	}
	.datagrid-cell-c2-delete {
		width: 37px
	}
</style>	
</head>
<body>
	<!--总容器 -->
	<div class="container bs-docs-container" style="width:100%;">
		<div class="main">
			<div class="buttonArea">
				<span id="searchbtn" style="float:left;display:block">	
					<a href="javascript:void(0)" class="button blueButton" onclick="openDialog('添加商品','http://www.baidu.com')">添加</a>
					<a href="javascript:void(0)" class="button" onclick="del()">删除</a>
					<a href="javascript:void(0)" class="button" onclick="newTab('商品回收站','/version4/shop/admin/goods!trash_list.do')">回收站</a>
				</span>
				<span style="float: right;height:28px;"> 
					<a href="javascript:void(0)" class="button b_fr" id="aAdvanced">高级搜索</a>
					<a href="javascript:void(0)" class="button b_fr" onclick="searchGoods()">搜索</a>
					<input id="searchKeyword" class="input_text b_fr mr5" type="text" value="" size="30" placeholder="请输入模糊关键字" name="searchKeyWord"> 
				</span>
			</div>
			<div style="display: block;" class="searchAdvanced">
				<table width="98%" border="0" cellspacing="0" cellpadding="8">
					<tbody>
						<tr>
							<td width="70" align="right">商品名称</td>
							<td>
								<input type="text" value="" id="name" class="input_text" style="width: 95%;">
							</td>
							<td width="70" align="right">商品编号</td>
							<td>
								<input type="text" value="" id="sn" class="input_text" style="width: 95%;">
							</td>
							<td width="70" align="right">类别</td>
							<td>
								<input class="easyui-combotree combotree-f combo-f" id="catid" data-options="" style="width: 200px; height: 28px; display: none;" comboname="cat.parent_id">
							</td>
							<td>
								<a id="searchAdvance" class="button blueButton" onclick="searchGoods()" href="javascript:;">开始搜索</a>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			
			
			<table id="tg" class="easyui-treegrid" style="width:auto;" data-options="">
			</table>
		</div>
	</div>
</body>
</html>
<script>
$(function(){
	$('#tg').treegrid({
		   collapsible: true,
		   url:'/treegrid.htm?pid=0', 
		   rownumbers: true,
		   animate:true,
		   fitColumns: true,
		   method: 'get',
		   idField:'id',
		   width:'100%',
		   treeField:'name',
		   onBeforeExpand:function(row,param){
			    if(row){
			    	$('#tg').treegrid('options').url='http://127.0.0.1:8080/treegrid.htm?pid='+row.id;
			    	alert('1  '+row.id);
			    }else{
			    	alert('2  '+row.id);
			    }
		   },
		   onDblClick:function(row,param){
			    	alert(row.id);
		   },
		   columns:[[
			   {field:'id',title:'ID',width:180,editor:'text',align:'center'},
		       {field:'name',title:'名称',width:180,editor:'text',align:'center'},  
		       {field:'persons',title:'类型',width:160,editor:'numberbox',align:'center'},
		       {field:'progress',title:'排序',width:140,editor:'numberbox',align:'center',formatter:formatProgress},
		       {field:'add',title:'添加子',editor:'datebox',align:'center'},
		       {field:'edit',title:'编辑',align:'center'},
		       {field:'delete',title:'删除',editor:'datebox',align:'center'}
		   ]]
	});
});
function formatProgress(value){
	if (value){
    	var s = '<div style="width:100%;border:1px solid #ccc">' +
    			'<div style="width:' + value + '%;background:#cc0000;color:#fff">' + value + '%' + '</div>'
    			'</div>';
    	return s;
	} else {
    	return '';
	}
}
</script>
<!-- 对分类的操作 -->
<script>
function openDialog(title,file_url){
	console.log(art);
	art.dialog.data(title,file_url);
	///art.dialog.open('./ui_add.html');
}
</script>